package com.smx.steppingstone.ui;

import javax.faces.component.UIComponent;
import javax.faces.webapp.UIComponentELTag;

public class SteppingStoneTag extends UIComponentELTag {

	// PROPERTY: Renderer type = HTML,SVG 
	private javax.el.ValueExpression rendererType;	

	public void setRendererType(javax.el.ValueExpression rendererType) {
		this.rendererType = rendererType;
	}

	// PROPERTY: object that we want to inspect
	private javax.el.ValueExpression object;

	public void setObject(javax.el.ValueExpression object) {
		this.object = object;
	}
	
	// PROPERTY: Renderer type = HTML,SVG 
	private javax.el.ValueExpression depth;	
	
	
	@Override
	public String getComponentType() {
		return "com.smx.steppingstone.ui.UISteppingStone";
	}

	@Override
	public String getRendererType() {
		return null;
	}

	@Override
	protected void setProperties(UIComponent component) {
		try{
			super.setProperties(component);
			UISteppingStone stone = null;
			try {
				stone = (UISteppingStone)component;
			} catch (ClassCastException cce) {
				throw new IllegalStateException(
						"Component "
						+ component.toString()
						+ " not expected type.  Expected: com.smx.steppingstone.ui.UISteppingStone  Perhaps you're missing a tag?");
			}

			/**
		//Inidicates current selection of item
		ValueExpression selectedExp=application.getExpressionFactory().createValueExpression(context.getELContext(), selected.getExpressionString(), Class.class);
		component.setValueExpression("selected", selectedExp);
			 */
			if(null!=object){
				stone.setValueExpression("object", object);			
			}
			if(null!=rendererType){
				stone.setValueExpression("rendererType", rendererType);
			}
			if(null!=depth){
				stone.setValueExpression("depth", depth);
			}
		}catch (Exception e){
			e.printStackTrace();
		}
	}

	@Override
	public void release() {
		super.release();
	}




}
